package com.ants.boot.core.request;

import com.ants.boot.core.exception.NewNoHandleFoundException;
import org.springframework.boot.web.servlet.error.ErrorController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author : 蚂蚁会花呗
 * @date : 2023-08-28 11:12
 * 自定义异常抛出
 * 实现ErrorController实现其方法，并抛出自定义404异常，交由全局异常捕获类捕获
 **/
@Controller
public class Error404Request implements ErrorController {

    @RequestMapping("/error")
    @ResponseBody
    public void error(){
        throw new NewNoHandleFoundException("请求路由找不到，请核对！");
    }

/*    @Override
    public String getErrorPath() {
        return "/error";
    }*/
}
